var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
let jwt = require('jsonwebtoken');
let {SECRET} = require('./tools/config');


var indexRouter = require('./routes/index');
var userRouter = require('./routes/user');
let listRouter = require('./routes/list');
let searchListRouter = require('./routes/search_list');
let memberRouter = require('./routes/member');

var app = express();

app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/uploads',express.static(path.join(__dirname, './uploads')));


app.use('/v1', indexRouter);
app.use('/v1/list', listRouter);
app.use('/v1/search',searchListRouter);
app.use('/v1/user', userRouter);
app.use('/v1/member',memberRouter);




app.use((req,res)=>{
    res.send('找不到该资源');
})
module.exports = app;
